#include <iostream>
using namespace std;


#include "sendc.h"
using namespace sendc;

class Foo {
    int a, b;
public:
    Foo(int _a, int _b) : a(_a), b(_b) {}
    
    void set(int c, int d) { a = c; b = d; }
    void print() { cout << "ciccio print " << a << " " << b << endl; }
};

void print(int a, int b) { cout << "print " << a << " " << b << endl; }

int print1(int a, int b) { cout << "print " << a << " " << b << endl; return a+b; }

int main() {
    Signals mng;
    Foo foo(3, 4);
    mng.add_signal<void, int, int>((char*)"prova");
    mng.connect((char*)"prova", print);
    
    mng.connect((char*)"prova", (void(*)(int, int))print1);
    mng.connect((char*)"prova", &foo, &Foo::set);
    cout << "EMITTING..." << endl;
    mng.emit<void, int, int>((char*)"prova", 1, 2);
    cout << "EMITTED" << endl;
    foo.print();
    return 0;
}
